package com.px.tc_ip;

import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;

public class ComestonDemon  {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        try {

            Socket s=new Socket("192.168.1.248",1235);
            System.out.println("连接成功");
            OutputStream outputStream=s.getOutputStream();
            while (true) {
                String a=scanner.nextLine();
                PrintWriter aa=new PrintWriter(new OutputStreamWriter(outputStream,"UTF-8"));
                aa.print(a);
                aa.flush();
                s.shutdownOutput();
            }

        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
